package com.ymh.git.thread.juc;

import java.util.concurrent.TimeUnit;

/**
 * Created by aivin on 2018/11/1.
 * <p>
 * 线程休眠辅助工具类
 */
public class SleepTools {


    /**
     * 按秒休眠
     *
     * @param second
     */
    public static void second(int second) {
        try {
            TimeUnit.SECONDS.sleep(second);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }


    /**
     * 按毫秒数休眠
     *
     * @param ms
     */
    public static void ms(int ms) {
        try {
            TimeUnit.MILLISECONDS.sleep(ms);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
